package com.nuo.modules.signRecord.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nuo.common.utils.PageUtils;
import com.nuo.common.utils.Query;

import com.nuo.modules.signRecord.dao.SignRecordDao;
import com.nuo.modules.signRecord.entity.SignRecordEntity;
import com.nuo.modules.signRecord.service.SignRecordService;


@Service("signRecordService")
public class SignRecordServiceImpl extends ServiceImpl<SignRecordDao, SignRecordEntity> implements SignRecordService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String name = params.get("teacherName").toString();
        String time = params.get("dateTime").toString();

        IPage<SignRecordEntity> page = this.page(
                new Query<SignRecordEntity>().getPage(params),
                new LambdaQueryWrapper<SignRecordEntity>()
                        .like(StringUtils.isNotBlank(name) ,SignRecordEntity::getUsername, name)
                        .like(StringUtils.isNotBlank(time) ,SignRecordEntity::getCreateTime, time)
        );
        return new PageUtils(page);
    }

}
